package com.yawn;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;

import java.io.File;
import java.io.FileInputStream;
import java.util.zip.ZipInputStream;

/**
 * @author Created by yawn on 2017-12-09 14:32
 */
public class TestDeployZip {

    public static void main(String[] args) throws Exception {
        // 默认的流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
        // 存储服务
        RepositoryService repositoryService = engine.getRepositoryService();
        // deploymentBuilder (部署builder)
        DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
        // 添加zip输入流到部署
        FileInputStream fis = new FileInputStream(new File("target/classes/datas.zip"));
        ZipInputStream zis = new ZipInputStream(fis);
        deploymentBuilder.addZipInputStream(zis);
        deploymentBuilder.deploy();

        engine.close();
    }
}
